home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 9.5 KB | 229 lines | [TEXT/MPS ] |
- ;
- ; File: ConditionalMacros.a
- ;
- ; Contains: Set up for compiler independent conditionals
- ;
- ; Version: Technology: Universal Interface Files 3.0dx
- ; Release: Universal Interfaces 3.0d3 on Copland DR1
- ;
- ; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
- IF &TYPE('__CONDITIONALMACROS__') = 'UNDEFINED' THEN
- __CONDITIONALMACROS__ SET 1
-
- ;
- ;***************************************************************************************************
- ; UNIVERSAL_INTERFACES_VERSION
- ;
- ; 0x0300 => version 3.0
- ; 0x0210 => version 2.1
- ; This conditional did not exist prior to version 2.1
- ;***************************************************************************************************
- ;
- UNIVERSAL_INTERFACES_VERSION EQU $0300
- ;
- ;***************************************************************************************************
- ; GENERATINGPOWERPC - Compiler is generating PowerPC instructions
- ; GENERATING68K - Compiler is generating 68k family instructions
- ;
- ; Invariant:
- ; GENERATINGPOWERPC != GENERATING68K
- ;***************************************************************************************************
- ;
- IF &TYPE('PowerAsm') <> 'UNDEFINED' THEN
- GENERATINGPOWERPC: SET 1
- GENERATING68K: SET 0
- ELSE
- GENERATINGPOWERPC: SET 0
- GENERATING68K: SET 1
- ENDIF
- ;
- ;***************************************************************************************************
- ; GENERATING68881 - Compiler is generating mc68881 floating point instructions
- ;
- ; Invariant:
- ; GENERATING68881 => GENERATING68K
- ;***************************************************************************************************
- ;
- IF &TYPE('GENERATING68881') = 'UNDEFINED' THEN
- GENERATING68881: SET 0
- ENDIF
- ;
- ;***************************************************************************************************
- ; GENERATINGCFM - Code being generated assumes CFM calling conventions
- ; CFMSYSTEMCALLS - No A-traps. Systems calls are made using CFM and UPP's
- ;
- ; Invariants:
- ; GENERATINGPOWERPC => GENERATINGCFM
- ; GENERATINGPOWERPC => CFMSYSTEMCALLS
- ; CFMSYSTEMCALLS => GENERATINGCFM
- ;***************************************************************************************************
- ;
- GENERATINGCFM: SET GENERATINGPOWERPC
- CFMSYSTEMCALLS: SET GENERATINGPOWERPC
- IF GENERATING68K THEN
- IF &TYPE('&SYSMODEL') <> 'UNDEFINED' THEN
- IF &SYSMODEL = '__CFM68K__' THEN
- GENERATINGCFM: SET 1
- CFMSYSTEMCALLS: SET 1
- ENDIF
- ENDIF
- ENDIF
- ;
- ;***************************************************************************************************
- ; One or none of the following BUILDING_≈ conditionals is expected to be set during
- ; compilation (e.g. MrC -d BUILDING_FOR_SYSTEM7), the others should be left undefined.
- ; If none is set, BUILDING_FOR_SYSTEM7_AND_SYSTEM8 is used.
- ;
- ; BUILDING_FOR_SYSTEM7 - Code is intended to run on System 7.x machine or earlier .
- ; BUILDING_FOR_SYSTEM7_AND_SYSTEM8 - Code is intended to run on System 7 or Copland.
- ; BUILDING_FOR_SYSTEM8 - Code is intended to run on Copland only.
- ; BUILDING_PREEMPTIVE_CODE - Code is intended to run as Copland server or driver.
- ;
- ; The following conditionals are set up based on which of the BUILDING_≈ flag (above) was specified.
- ; They are used in throughout the interface files to conditionalize declarations.
- ;
- ; FOR_SYSTEM7_ONLY - In System 7. Not in Copland.
- ; FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED - In System 7. Works in Copland, but there is a better way.
- ; FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE - In System 7. In Copland, but only for cooperative tasks.
- ; FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE - In System 7. In Copland.
- ; FOR_SYSTEM8_COOPERATIVE - Not in System 7. In Copland, but only for cooperative tasks.
- ; FOR_SYSTEM8_PREEMPTIVE - Not in System 7. In Copland.
- ;
- ; FOR_OPAQUE_SYSTEM_DATA_STRUCTURES - Always true for system 8, but can be set by developer to
- ; true or false for System 7. When true, the contents of
- ; many system data structures are removed from the interfaces.
- ; In the future, the Mac OS will have fewer data structures
- ; shared between applications and the system. The problem
- ; with shared data is 1) the system has to poll the data
- ; to detect changes made by an application, 2) it prevents
- ; data structures from being changed in the future.
- ; Procedural interface will be used instead.
- ;
- ; FOR_PTR_BASED_AE - This is a temporary fix for Copland DR1. It is needed to
- ; distinguish between pointer based and handle based AppleEvents.
- ; If you are in the case of BUILDING_FOR_SYSTEM7_AND_SYSTEM8
- ; and want to use new pointer base AppleEvents, you will need to
- ; -d FOR_PTR_BASED_AE on your compiler command line.
- ;
- ;***************************************************************************************************
- ;
- IF 0 THEN
- ; extra if statement is to work around a bug in PPCAsm 1.2a2
- ELSEIF (&TYPE('BUILDING_FOR_SYSTEM7') <> 'UNDEFINED') THEN
- IF &TYPE('FOR_OPAQUE_SYSTEM_DATA_STRUCTURES') = 'UNDEFINED' THEN
- FOR_OPAQUE_SYSTEM_DATA_STRUCTURES: SET 0
- ENDIF
- FOR_PTR_BASED_AE: SET 0
- FOR_SYSTEM7_ONLY: SET 1
- FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED: SET 1
- FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE: SET 1
- FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE: SET 1
- FOR_SYSTEM8_COOPERATIVE: SET 0
- FOR_SYSTEM8_PREEMPTIVE: SET 0
- ELSEIF (&TYPE('BUILDING_FOR_SYSTEM7_AND_SYSTEM8') <> 'UNDEFINED') THEN
- IF &TYPE('FOR_OPAQUE_SYSTEM_DATA_STRUCTURES') = 'UNDEFINED' THEN
- FOR_OPAQUE_SYSTEM_DATA_STRUCTURES: SET 1
- ENDIF
- IF &TYPE('FOR_PTR_BASED_AE') = 'UNDEFINED' THEN
- FOR_PTR_BASED_AE: SET 0
- ENDIF
- FOR_SYSTEM7_ONLY: SET 0
- FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED: SET 1
- FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE: SET 1
- FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE: SET 1
- FOR_SYSTEM8_COOPERATIVE: SET 1
- FOR_SYSTEM8_PREEMPTIVE: SET 1
- ELSEIF (&TYPE('BUILDING_FOR_SYSTEM8') <> 'UNDEFINED') THEN
- FOR_OPAQUE_SYSTEM_DATA_STRUCTURES: SET 1
- FOR_PTR_BASED_AE: SET 1
- FOR_SYSTEM7_ONLY: SET 0
- FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED: SET 0
- FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE: SET 1
- FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE: SET 1
- FOR_SYSTEM8_COOPERATIVE: SET 1
- FOR_SYSTEM8_PREEMPTIVE: SET 1
- ELSEIF (&TYPE('BUILDING_PREEMPTIVE_CODE') <> 'UNDEFINED') THEN
- FOR_OPAQUE_SYSTEM_DATA_STRUCTURES: SET 1
- FOR_PTR_BASED_AE: SET 1
- FOR_SYSTEM7_ONLY: SET 0
- FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED: SET 0
- FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE: SET 0
- FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE: SET 1
- FOR_SYSTEM8_COOPERATIVE: SET 0
- FOR_SYSTEM8_PREEMPTIVE: SET 1
- ELSE
- ; default is BUILDING_FOR_SYSTEM7_AND_SYSTEM8
- FOR_OPAQUE_SYSTEM_DATA_STRUCTURES: SET 1
- IF &TYPE('FOR_PTR_BASED_AE') = 'UNDEFINED' THEN
- FOR_PTR_BASED_AE: SET 0
- ENDIF
- FOR_SYSTEM7_ONLY: SET 0
- FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED: SET 1
- FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE: SET 1
- FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE: SET 1
- FOR_SYSTEM8_COOPERATIVE: SET 1
- FOR_SYSTEM8_PREEMPTIVE: SET 1
- ENDIF
- ;
- ;***************************************************************************************************
- ;
- ; OLDROUTINENAMES - "Old" names for Macintosh system calls are allowed in source code.
- ; (e.g. DisposPtr instead of DisposePtr). The names of system routine
- ; are now more sensitive to change because CFM binds by name. In the
- ; past, system routine names were compiled out to just an A-Trap.
- ; Macros have been added that each map an old name to its new name.
- ; This allows old routine names to be used in existing source files,
- ; but the macros only work if OLDROUTINENAMES is true. This support
- ; will be removed in the near future. Thus, all source code should
- ; be changed to use the new names! You can set OLDROUTINENAMES to false
- ; to see if your code has any old names left in it.
- ;
- ; OLDROUTINELOCATIONS - "Old" location of Macintosh system calls are used. For example, c2pstr
- ; has been moved from Strings to TextUtils. It is conditionalized in
- ; Strings with OLDROUTINELOCATIONS and in TextUtils with !OLDROUTINELOCATIONS.
- ; This allows developers to upgrade to newer interface files without suddenly
- ; all their code not compiling becuase of "incorrect" includes. But, it
- ; allows the slow migration of system calls to more understandable file
- ; locations. OLDROUTINELOCATIONS currently defaults to true, but eventually
- ; will default to false.
- ;
- ;***************************************************************************************************
- ;
- IF &TYPE('OLDROUTINENAMES') = 'UNDEFINED' THEN
- OLDROUTINENAMES: SET 0
- ENDIF
- IF &TYPE('OLDROUTINELOCATIONS') = 'UNDEFINED' THEN
- OLDROUTINELOCATIONS: SET 0
- ENDIF
- ;
- ;***************************************************************************************************
- ; IMPORT_CFM_FUNCTION - Macro used instead of IMPORT pseduo opcode because PowerPC
- ; and 68K CFM runtimes differ on naming of imported functions.
- ; PowerPC requires a period (.) in front of the name and CFM 68K
- ; does not. This macros supplies the period for PowerPC.
- ;***************************************************************************************************
- ;
- IF GENERATINGCFM THEN
- IF GENERATINGPOWERPC THEN
- Macro
- IMPORT_CFM_FUNCTION &functionName
- IMPORT .&functionName
- EndM
- ELSE
- Macro
- IMPORT_CFM_FUNCTION &functionName
- IMPORT &functionName
- EndM
- ENDIF
- ENDIF
- ENDIF ; __CONDITIONALMACROS__
-
-